<?php

class Form_CategoryForm extends Form_Custom_General {

    public function init() {

        $cat_id = $this->createElement('hidden', 'cat_id')
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($cat_id);

        $cat_name = $this->createElement('text', 'cat_name')
                ->setRequired(TRUE)
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Category name should not be blank.')))
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                ))
                ->setAttribs(Array("size" => "60"));
        $this->addElement($cat_name);

        $cat_parentid = $this->createElement('select', 'cat_parentid')
                ->setRequired(TRUE)
                ->addFilters(array(
                    new Zend_Filter_StringTrim(),
                    new Zend_Filter_StringToLower()
                ))
                ->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select parent category.')));
        $this->addElement($cat_parentid);
        
        $submit = $this->createElement('submit', 'Save')
                ->setAttribs(Array('title' => "Save changes"));
        $this->addElement($submit);


        $reset = $this->createElement('reset', 'Reset')
                ->setAttribs(Array('title' => "Save changes and continue to edit"));
        $this->addElement($reset);
    }

}